package com.wang.system.config;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author wang
 * @Date 2024/9/22 18:59
 * @PackageName:com.wang.system.config
 * @ClassName: TenantInterceptor
 * @Description: TODO
 * @Version 1.0
 */
@Component
public class TenantInterceptor implements HandlerInterceptor {

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
        TenantContext.clear();  // 请求结束时清理租户信息
    }
}